<template>
	<view>
		<view class="nvue-page-root">
			<view class="uni-common-mt">
				<view class="uni-form-item uni-column">
					<view class="title"><text class="uni-form-item__title">用户名:</text></view>
					<view class="uni-input-wrapper">
						<input class="uni-input" focus placeholder="请输入用户名" v-model="form.loginName" />
					</view>
				</view>
				<view class="uni-form-item uni-column">
					<view class="title"><text class="uni-form-item__title">密码:</text></view>
					<view class="uni-input-wrapper">
						<input class="uni-input" placeholder="请输入密码" :password="showPassword" v-model="form.loginKey" />
						<text class="uni-icon" :class="[!showPassword ? 'uni-eye-active' : '']" @click="changePassword">&#xe568;</text>
					</view>
				</view>
			</view>
		</view>
		<button type="default" @click="loginFn">登录</button>
	</view>
</template>

<script>
	import {mapActions} from 'vuex'
	export default {
		data() {
			return {
				form:{
					loginName:'',
					loginKey:''
				},
				showPassword:true
			}
		},
		methods: {
			...mapActions("login",["getuser"]),
			changePassword(){
				this.showPassword=!this.showPassword
			},
			loginFn(){
				// console.log(this.form)
				this.getuser(this.form)
				uni.switchTab({
				    url: '/pages/setting/setting'
				});
			}
		},
		onLoad() {
			
		}
	}
</script>

<style>
.nvue-page-root {
		background-color: #F8F8F8;
		/* padding-bottom: 20px; */
	}

	.page-title {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		justify-content: center;
		align-items: center;
		padding: 35rpx;
	}

	.page-title__wrapper {
		padding: 0px 20px;
		border-bottom-color: #D8D8D8;
		border-bottom-width: 1px;
	}

	.page-title__text {
		font-size: 16px;
		height: 48px;
		line-height: 48px;
		color: #BEBEBE;
	}

	.title {
		padding: 5px 13px;
	}

	.uni-form-item__title {
		font-size: 16px;
		line-height: 24px;
	}

	.uni-input-wrapper {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		padding: 8px 13px;
		flex-direction: row;
		flex-wrap: nowrap;
		background-color: #FFFFFF;
	}

	.uni-input {
		height: 28px;
		line-height: 28px;
		font-size: 15px;
		padding: 0px;
		flex: 1;
		background-color: #FFFFFF;
	}

	.uni-icon {
		font-family: uniicons;
		font-size: 24px;
		font-weight: normal;
		font-style: normal;
		width: 24px;
		height: 24px;
		line-height: 24px;
		color: #999999;
	}

	.uni-eye-active {
		color: #007AFF;
	}
</style>
